Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Detect circular dependencies with Madge #17924

Merged
merged 17 commits into from
Jan 15, 2025

Conversation

iOvergaard
Copy link
Contributor

@iOvergaard iOvergaard commented Jan 9, 2025

Description

This is setting up a script to run Madge (effectively npm run check:circular but with Node.js) so the build can either fail or warn if circular dependencies are detected.

There are 11 circular dependencies, so we might want to set this to warn until they are fixed.

Check this previous run to see what it looks like in error mode: https://github.com/umbraco/Umbraco-CMS/actions/runs/12689060972/job/35366940767

If you have changed one of the files that has a circular dependency, the error will also pop up as an annotation on that file in the "Files changed" view.

How to test

Run the script locally:

cd src/Umbraco.Web.UI.Client
node devops/circular/index.js src

Check that it shows the currently known circular dependencies.

@iOvergaard iOvergaard changed the title V15/feature/ci-circular-deps Build: Detect circular dependencies with Madge Jan 9, 2025
@iOvergaard iOvergaard marked this pull request as ready for review January 9, 2025 11:34
Copy link
Contributor

@madsrasmussen madsrasmussen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🥳

I have updated the script in package.json to run the devops version too. Then we don't end up with inconsistent result.

We could consider setting an error threshold to 11 and fail the build if we exceed that until we start fixing the remaining issues 🤔

@iOvergaard iOvergaard merged commit c8547d9 into v15/dev Jan 15, 2025
29 checks passed
@iOvergaard iOvergaard deleted the v15/feature/ci-circular-deps branch January 15, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants